//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_VOLUME_TEXTURE_H
#define _UX_VOLUME_TEXTURE_H

#include "CTexture.h"

namespace Engine
{
namespace Resources
{

	//
	// Volume Texture
	//

	class _EXPORT_ CVolumeTexture : public CTexture
	{
	protected:
		CVolumeTexture(const char *pFileName, e_tex_flags::type eFlags, gl_texture::type eTarget);
		virtual ~CVolumeTexture();
		
		virtual bool _Load(IFilePtr pFile, uint uSize);
		virtual bool _Save(IFilePtr pFile);

		bool _Create(const uvec3 &sDim, e_tex_format::type eFormat, e_tex_swizzle::type eSwizzle, e_tex_flags::type eFlags);

	public:
		bool Copy(TImage3D &sImage, e_tex_format::type eFormat, bool bMipMaps = true);
		bool CopyToBuffer(GLuint uBufIdx, e_tex_format::type eFormat = e_tex_format::UNKNOWN, uint uOffset = 0);

		bool Create(const TImage3D &sImage, e_tex_flags::type eFlags = e_tex_flags::UNKNOWN);
		bool Create(const array<TImage2D> &aImages, e_tex_flags::type eFlags = e_tex_flags::UNKNOWN);
		bool AddImage(const TImage3D &sImage, const uvec3 &vOffset);
		bool AddImage(const TImage2D &sImage, const uvec2 &vOffset, uint uLayer);
		
		virtual bool Create(const uvec3 &vDim, e_tex_format::type eFormat, e_tex_swizzle::type eSwizzle,
							e_tex_flags::type eFlags, uint16 uSamples = 0);

		virtual e_resource::type GetType()	const	{ return e_resource::TEXTURE_3D; }
	};
	

	//
	// Texture 2D Array
	//

	class _EXPORT_ CTexture2DArray : public CVolumeTexture
	{
	protected:
		CTexture2DArray(const char *pFileName, e_tex_flags::type eFlags);

	public:
		static CTexture2DArrayPtr s_CreateTexture2DArray(const char *pFileName, e_tex_flags::type eFlags);
	};


	//
	// Texture 3D
	//

	class _EXPORT_ CTexture3D : public CVolumeTexture
	{
	protected:
		CTexture3D(const char *pFileName, e_tex_flags::type eFlags);

	public:
		static CTexture3DPtr s_CreateTexture3D(const char *pFileName, e_tex_flags::type eFlags);
	};

//-------------------------------------------------------------------

}	// Resources
}	// Engine

#endif	// _UX_VOLUME_TEXTURE_H